import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
export default function Auth({ children }) {
    const token = sessionStorage.getItem("token");
    const navigate = useNavigate();
    useEffect(() => {
        if (!token || token === "null") {
            navigate("/login", { replace: true });
        }
    }, [token]);
    return children
}